﻿$(document).ready(function () {
    BatchPayFunc.getBatchInfo();
});

var BatchPayFunc = {
    getBatchInfo: function () {
        $.ajax({
            type: "get",
            url: "/api/batchpay.ashx",
            data: {
                enableRemit: "1"
            },
            cache: false,
            dataType: "json",
            success: function (c) {
                var batchpays = c.LstBatchPay;
                var orderCount = c.OrderCount;
                var sumAmonut = c.SumAmonut;

                $("span#orderNum").text = orderCount;
                $("span#totalAmount").innerHTML = sumAmonut;

                for (var idx = 0; idx < batchpays.length; idx++) {
                    $("#dt_gal tbody").append("<tr><td>" + batchpays[idx].BankCardType + "</td><td>" + batchpays[idx].BankCardNo + "</td><td>" + batchpays[idx].CardName + "</td><td>" + batchpays[idx].Amount + "</td></tr>");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
               
            console.trace(XMLHttpRequest.statusText);
            console.trace(errorThrown);
            console.trace("fail");
        }
        });
    }
};